﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.HashUnsafeUtilities
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

#nullable disable
namespace UnityEngine
{
  /// <summary>
  ///   <para>Utilities to compute hashes with unsafe code.</para>
  /// </summary>
  public static class HashUnsafeUtilities
  {
    /// <summary>
    ///   <para>Compute a 128 bit hash based on a data.</para>
    /// </summary>
    /// <param name="data">Pointer to the data to hash.</param>
    /// <param name="dataSize">The number of bytes to hash.</param>
    /// <param name="hash1">A pointer to store the low 64 bits of the computed hash.</param>
    /// <param name="hash2">A pointer to store the high 64 bits of the computed hash.</param>
    /// <param name="hash">A pointer to the Hash128 to updated with the computed hash.</param>
    public static unsafe void ComputeHash128(
      void* data,
      ulong dataSize,
      ulong* hash1,
      ulong* hash2)
    {
      SpookyHash.Hash(data, dataSize, hash1, hash2);
    }

    /// <summary>
    ///   <para>Compute a 128 bit hash based on a data.</para>
    /// </summary>
    /// <param name="data">Pointer to the data to hash.</param>
    /// <param name="dataSize">The number of bytes to hash.</param>
    /// <param name="hash1">A pointer to store the low 64 bits of the computed hash.</param>
    /// <param name="hash2">A pointer to store the high 64 bits of the computed hash.</param>
    /// <param name="hash">A pointer to the Hash128 to updated with the computed hash.</param>
    public static unsafe void ComputeHash128(void* data, ulong dataSize, Hash128* hash)
    {
      ulong u640 = hash->u64_0;
      ulong u641 = hash->u64_1;
      HashUnsafeUtilities.ComputeHash128(data, dataSize, &u640, &u641);
      *hash = new Hash128(u640, u641);
    }
  }
}
